package test_2024_4_3_01;

import java.util.Scanner;
public class Supermarket{


	public void show() {
		
		System.out.println("***********首页************");
		System.out.println("请选择：");
		System.out.println("1. 挑选商品");
		System.out.println("2. 结账页面");
		System.out.println("3. 幸运大奖");	
	}
	
	public double shopping(double payMoney) 
	{
		System.out.println("*******欢迎来到选购商品页面*******");
		Scanner scan = new Scanner(System.in);
		boolean flag = true;
		
		while(flag)
		{
			System.out.println("1. 苹果 ￥2");
			System.out.println("2. 梨  ￥5");
			System.out.println("3. 香蕉 ￥3");
			System.out.println("*******请输入您需要的商品：*******");
			int i = scan.nextInt();
			
			switch(i)
			{
			case 1:
				payMoney += 2;
				System.out.println("总金额：" + payMoney);
				break;
			case 2:
				payMoney += 5;
				System.out.println("总金额：" + payMoney);
				break;
			case 3:
				payMoney += 3;
				System.out.println("总金额：" + payMoney);
				break;
			default:
				System.out.println("离开？！(y / other)");
				String y = scan.next();
				switch(y)
				{
				case "y":
				flag = false;
				break;
				};
			}
			
		}
		return payMoney;
		}
	
//	public void pay(double payMoney) {
//		double money = 0;
//		System.out.println("待支付：");
//		return money;
//	}
	
		
	public void pay(double payMoney)
	{
		System.out.println("待支付：" + payMoney);
	}
}

